////////////////////////////////////////////////////////////////////////////////
// Copyright 2007 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   CATALOG_SECURITY
// AUTHOR           :   Saint Peng
// DATE CREATE      :   2007/03/29
// DESCRIPTION      :   a MAINTENANCE ACTION file for the function, CATALOG_SECURITY
//                  :
//                  :
//                  :
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2007/03/29   Saint Peng      1.0                 source is generated.
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.app.catalog.catalogSecurity.web;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.LinkedList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.erp.app.catalog.catalogSecurity.pk.CatalogSecurityHdrPk;
import com.erp.app.catalog.catalogSecurity.schema.CatalogSecurityHdrSchema;
import com.erp.app.catalog.catalogSecurity.vo.CatalogSecurityHdrVo;
import com.erp.app.catalog.catalogTreePopup.web.PopupCatalogTreeRow;
import com.erp.app.common.ProjectConstants;
import com.erp.app.common.select.beans.SelectDelegate;
import com.erp.app.util.web.WebUtil;
import com.erp.common.web.SearchResultRow;
import com.erp.framework.controller.action.SimpleMaintStyleActionTemplate;
import com.erp.framework.controller.form.MultiRow;
import com.erp.framework.model.pk.SimpleBasePk;
import com.erp.framework.model.schema.TableSchema;
import com.erp.framework.model.vo.ChildList;
import com.erp.framework.model.vo.SimpleBaseVo;
import com.erp.framework.util.CommonUtil;
import com.erp.framework.util.CopyUtil;
import com.erp.framework.util.logger.Logger;
import com.erp.framework.util.user.User;

/**
* A <strong>Maintenance Action</strong> is an adapter between the contents of an incoming
* HTTP request and the corresponding business logic that should be executed to
* process this request.  The controller (ActionServlet) will select an
* appropriate Action for each request.
* The main purpose for this action class is to handle the user document maintenance events
* from the web browsers.
*
* @author          Saint Peng
* @version 1.0     2007/03/29
* @since           FrameWork 1.0
*
*/
public class CatalogSecurityMaintenanceAction extends SimpleMaintStyleActionTemplate {

	////////////////////////////////////////////////////////////////////////////////
	// PRIVATE VARIABLES DEFINITION
	////////////////////////////////////////////////////////////////////////////////

//	The following classes can be used to access common utilities,
//	delegate methods, and common validation functions.
//	private CatalogSecurityCommonUtil util = new CatalogSecurityCommonUtil();
//	private CatalogSecurityCommonDelegate dg = new CatalogSecurityCommonDelegate();
	private CatalogSecurityCommonValidator validator = new CatalogSecurityCommonValidator();


	////////////////////////////////////////////////////////////////////////////////
	// GLOBAL VARIABLES DEFINITION
	////////////////////////////////////////////////////////////////////////////////



	////////////////////////////////////////////////////////////////////////////////
	// CONSTANTS DEFINITION
	////////////////////////////////////////////////////////////////////////////////

	//public static final String ACTION_DO_SOMETHING = "actionDoSomething";
	//public static final String STATUS_DO_SOMETHING = "statusDoSomething";

	public static final int TAB_IDX_HDR = -1;
	public static final int TAB_IDX_DTL = 0;
	public static final int TAB_IDX_FIELD = 1;
	public static final int TAB_IDX_LIGHTBOX = 2;

	public static final String ACTION_CHANGE_FOLDER_HDR=ACTION_CHANGE_FOLDER+"Hdr";
	public static final String ACTION_CHANGE_FOLDER_DTL=ACTION_CHANGE_FOLDER+"Dtl";
	public static final String ACTION_CHANGE_FOLDER_FIELDS=ACTION_CHANGE_FOLDER+"Fields";
	public static final String ACTION_CHANGE_FOLDER_LIGHTBOX=ACTION_CHANGE_FOLDER+"LightBox";

	public static final String ACTION_ADD_RETRIEVE_DTL = "addRetrieveDtl";
	public static final String STATUS_ADD_RETRIEVE_DTL = "addRetrieveDtl";
	public static final String ACTION_ADD_RETRIEVE_FIELD = "addRetrieveField";
	public static final String STATUS_ADD_RETRIEVE_FIELD = "addRetrieveField";
	public static final String ACTION_DEL_RETRIEVE_DTL = "delRetrieveDtl";
	public static final String ACTION_DEL_RETRIEVE_FIELD = "delRetrieveField";
	public static final String ACTION_ADD_RETRIEVE_ITEM = "addRetrieveItem";
	public static final String STATUS_ADD_RETRIEVE_ITEM = ACTION_ADD_RETRIEVE_ITEM;
	public static final String ACTION_DEL_RETRIEVE_ITEM = "delRetrieveItem";
	public static final String ACTION_ADD_MY_LIGHTBOX_ITEM = "addMyLightboxItem";
	public static final String STATUS_ADD_MY_LIGHTBOX_ITEM = ACTION_ADD_MY_LIGHTBOX_ITEM;
	public static final String ACTION_DEL_MY_LIGHTBOX_ITEM = "delMyLightboxItem";

	public static final String ACTION_COPY_FROM_OTHER_USER = "copyFromOtherUser";
	public static final String STATUS_COPY_FROM_OTHER_USER = ACTION_COPY_FROM_OTHER_USER;

	public static final String ROW_DEL_CHECKED = "checked";

	////////////////////////////////////////////////////////////////////////////////
	// LOGICAL AND BUSINESS METHODS
	////////////////////////////////////////////////////////////////////////////////








	public ActionForward  processActionAddRetrieveDtl(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {

		HttpSession session = request.getSession(false);
		CatalogSecurityMaintenanceForm form = (CatalogSecurityMaintenanceForm) formIn;
		String action = form.getPageEvent();
		ActionForward actionForward = new ActionForward(mapping.getInput());
		User editingUser = (User) session.getAttribute(ProjectConstants.SESSION_USER);
		try {
			session.setAttribute(getSessionSimpleMaintStatus(), STATUS_ADD_RETRIEVE_DTL);

            HashMap params = new HashMap();
            params.put("falseSetParent", ProjectConstants.GENERIC_YES);
            params.put("trueSetChild", ProjectConstants.GENERIC_YES);
			session.removeAttribute(ProjectConstants.POP_UP_CATALOG_TREE_CHECKBOX_PARAMS);
			session.setAttribute(ProjectConstants.POP_UP_CATALOG_TREE_CHECKBOX_PARAMS, params);
        } catch (Exception e) {
            Logger.logExceptions(this, e);
        }


		return actionForward;

	}

	public ActionForward  processActionAddRetrieveItem(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {

		HttpSession session = request.getSession(false);
		CatalogSecurityMaintenanceForm form = (CatalogSecurityMaintenanceForm) formIn;
		String action = form.getPageEvent();
		ActionForward actionForward = new ActionForward(mapping.getInput());
		User editingUser = (User) session.getAttribute(ProjectConstants.SESSION_USER);
		try {

            LinkedList criteriaList = new LinkedList();
            TableSchema ts = form.getChildTs()[TAB_IDX_FIELD];

            String wh = "COMPANY_CODE = '" + WebUtil.getAppropriateCompanyCode(session, null) + "' " +
            			"AND REF_MASTER_CODE = '" + ProjectConstants.CD_CATALOG_DTL_TYPE + "' " +
            			"AND REF_STATUS = '" + ProjectConstants.GENERIC_ACTIVE + "' ";
            criteriaList.add(ts.getDisplayWebLabelByObjectId("LBL_FIELD_ITEM_DETAIL_TYPE"));
            criteriaList.add("COMBO");
            criteriaList.add("");
            criteriaList.add("T_CODE_DTL");
            criteriaList.add("REF_CODE");
            criteriaList.add("REF_DESC");
            criteriaList.add(wh);
            criteriaList.add("REF_DESC");
            criteriaList.add("");

            criteriaList.add(ts.getDisplayWebLabelByObjectId("LBL_FIELD_CATEGORY"));
            criteriaList.add("INPUT_WITH_WILDCARD");
            criteriaList.add("");

            criteriaList.add(ts.getDisplayWebLabelByObjectId("LBL_FIELD_ITEM_DETAIL_NAME"));
            criteriaList.add("INPUT_WITH_WILDCARD");
            criteriaList.add("");

            ArrayList criteriaColumnList = new ArrayList();

            criteriaColumnList.add("c.ITEM_DETAIL_TYPE");
            criteriaColumnList.add("b.description");
            criteriaColumnList.add("c.DESCRIPTION");


            ArrayList rsltTextList = new ArrayList();
            ArrayList rsltColumnList = new ArrayList();
            Hashtable tblParams = new Hashtable();

            rsltTextList.add(ts.getDisplayWebLabelByObjectId("LBL_GRID_ITEM_DETAIL_LINE_NO"));
            rsltTextList.add(ts.getDisplayWebLabelByObjectId("LBL_FIELD_NODE_ID"));
            rsltTextList.add(ts.getDisplayWebLabelByObjectId("LBL_FIELD_CATEGORY"));
            rsltTextList.add(ts.getDisplayWebLabelByObjectId("LBL_FIELD_ITEM_DETAIL_NAME"));
            rsltTextList.add(ts.getDisplayWebLabelByObjectId("LBL_FIELD_ITEM_DETAIL_TYPE"));

            rsltColumnList.add("B.DTL_ID");
            rsltColumnList.add("A.NODE_ID");
            rsltColumnList.add("A.DESCRIPTION");
            rsltColumnList.add("C.DTL_NAME");
            rsltColumnList.add("D.REF_DESC");
            rsltColumnList.add("C.DTL_TYPE");
            rsltColumnList.add("A.COMPANY_CODE");


            String where =  " A.COMPANY_CODE=B.COMPANY_CODE "+
					        " AND A.NODE_ID=B.NODE_ID "+
					        " AND B.COMPANY_CODE=C.COMPANY_CODE "+
					        " AND B.DTL_ID=C.DTL_ID "+
					        " AND C.COMPANY_CODE=D.COMPANY_CODE(+) "+
					        " AND C.DTL_TYPE=D.REF_CODE(+) "+
					        " AND A.COMPANY_CODE='" + WebUtil.getAppropriateCompanyCode(session, null) + "' " +
					        " AND D.REF_MASTER_CODE='" + ProjectConstants.CD_CATALOG_DTL_TYPE + "' "+
					        " AND D.REF_STATUS='ACTIVE' ";


            tblParams.put(ProjectConstants.SESSION_TABLE, "T_CATALOG A,T_CATALOG_DTL_TEMPLATE B,T_CATALOG_DTL C,T_CODE_DTL D");
            tblParams.put(ProjectConstants.SESSION_WHERE, where);

            HashMap params = new HashMap();
            params.put(ProjectConstants.SESSION_SESSION_NAME, getSessionSimpleMaintStatus());
            params.put(ProjectConstants.SESSION_SESSION_VALUE, STATUS_ADD_RETRIEVE_ITEM);
            params.put(ProjectConstants.SESSION_OPENER_PATH, getFunctionId());
            params.put(ProjectConstants.SESSION_EVENTSRC, form.getPageEventSrc());
            params.put(ProjectConstants.SESSION_SEARCH_CRITERIA_RESIZE_TO, new String[] { "970", "550" });
            params.put(ProjectConstants.SESSION_CRITERIA_LIST, criteriaList);
            params.put(ProjectConstants.SESSION_CRITERIA_COLUMN_LIST, criteriaColumnList);
            params.put(ProjectConstants.SESSION_RESULT_TEXT_LIST, rsltTextList);
            params.put(ProjectConstants.SESSION_RESULT_COLUMN_LIST, rsltColumnList);
            params.put(ProjectConstants.SESSION_TABLE_PARAMS, tblParams);
            params.put(ProjectConstants.SESSION_SHOW_OK_CANCEL_BTN, ProjectConstants.GENERIC_YES);
            params.put(ProjectConstants.SESSION_AUTO_SEARCH, ProjectConstants.GENERIC_YES);
            params.put(ProjectConstants.SESSION_SHOW_FROM_TO, ProjectConstants.GENERIC_NO);
            params.put(ProjectConstants.SESSION_SHOW_OK_CANCEL_BTN, ProjectConstants.GENERIC_YES);
            params.put(ProjectConstants.SESSION_SHOW_SEARCH_BTN, ProjectConstants.GENERIC_YES);
            params.put(ProjectConstants.SESSION_SHOW_SELECT_BOX, ProjectConstants.GENERIC_YES);
            session.setAttribute(ProjectConstants.SESSION_COMMON_SEARCH_PARAMETERS, params);

            return actionForward;

        } catch (Exception e) {
            Logger.logExceptions(this, e);
        }


		return actionForward;

	}

	public ActionForward processStatusAddRetrieveItem(ActionMapping mapping,
            ActionForm formIn, HttpServletRequest request,
            HttpServletResponse response, ActionErrors errors, String rs_status) {
		ActionForward actionForward = new ActionForward(mapping.getInput());
    	HttpSession session = request.getSession(false);
    	CatalogSecurityMaintenanceForm form = (CatalogSecurityMaintenanceForm) formIn;

        HashMap params = (HashMap) session.getAttribute(ProjectConstants.SESSION_COMMON_SEARCH_PARAMETERS);
        session.removeAttribute(ProjectConstants.SESSION_COMMON_SEARCH_PARAMETERS);
        ArrayList selectedList = (ArrayList) params.get(ProjectConstants.SESSION_SELECTED_LIST);

        if (selectedList == null || selectedList.size() == 0)
            return actionForward;
        try{
        	form.setCurrIdx(TAB_IDX_FIELD);
        	HashMap itemDetailMap = new HashMap();
        	ArrayList detailRows = form.getMultiRows(TAB_IDX_FIELD);
        	for(int i = 0; i < detailRows.size(); i++){
        		CatalogSecurityFieldRow row = (CatalogSecurityFieldRow) detailRows.get(i);
        		if(!CommonUtil.isEmpty(row.getIsDelete()))
        			continue;
        		itemDetailMap.put(row.getCompanyCode()+"+"+row.getFieldNodeId(), row.getCompanyCode()+"+"+row.getFieldNodeId());
        	}
        	String notAddDetailList = "";
        for (int i = 0; i < selectedList.size(); i++) {
            SearchResultRow sRow = (SearchResultRow) selectedList.get(i);

            if (sRow == null)
                continue;


            ArrayList dtlRows = form.getMultiRows(TAB_IDX_FIELD);

            if(CommonUtil.isEmpty(itemDetailMap.get( (CommonUtil.nullToString((String)sRow.getColumn7()))+"+"+CommonUtil.nullToString((String)sRow.getColumn2()) ))){
            	CatalogSecurityFieldRow rowToAdd= new CatalogSecurityFieldRow();
            	rowToAdd.setCompanyCode(form.getCompanyCode());
            	rowToAdd.setUserCode(form.getUserCode());
            	rowToAdd.setFieldCatalogName(CommonUtil.nullToString((String)sRow.getColumn3()));
            	rowToAdd.setFieldItemDetailName(CommonUtil.nullToString((String)sRow.getColumn4()));
            	rowToAdd.setFieldItemDetailType(CommonUtil.nullToString((String)sRow.getColumn5()));
            	rowToAdd.setFieldDtlId(CommonUtil.nullToString((String)sRow.getColumn1()));
            	rowToAdd.setFieldNodeId(CommonUtil.nullToString((String)sRow.getColumn2()));
                form.addRow(rowToAdd);
            }else{
            	if(CommonUtil.isEmpty(notAddDetailList)){
            		notAddDetailList = CommonUtil.nullToString((String)sRow.getColumn4());
            	}else{
            		notAddDetailList = notAddDetailList + ", " +  CommonUtil.nullToString((String)sRow.getColumn4());
            	}
            }
        }
        if(!CommonUtil.isEmpty(notAddDetailList)){
        	session.setAttribute(ProjectConstants.SESSION_ALERT_AFTER_ADD_SECURITY_ITEM, ProjectConstants.GENERIC_YES);
        	session.setAttribute(ProjectConstants.SESSION_ITEM_ALEADY_EXISTS_ITEMS, notAddDetailList);
        }
        }
        catch (Exception e) {
            Logger.logExceptions(this, e);
        }
        return actionForward;
    }


    public ActionForward processStatusAddRetrieveDtl(ActionMapping mapping,ActionForm formIn, HttpServletRequest request,
            HttpServletResponse response, ActionErrors errors, String rs_status) {
    	HttpSession session = request.getSession(false);
    	CatalogSecurityMaintenanceForm form = (CatalogSecurityMaintenanceForm) formIn;
        ActionForward actionForward = new ActionForward(mapping.getInput());
        ArrayList originRow = form.getMultiRows(TAB_IDX_DTL);
        HashMap originNodeMap = new HashMap();
        String duplicateNodeList = "";
        if(originRow != null && originRow.size() > 0) {
        	for(int i = 0; i < originRow.size(); i++) {
        		originNodeMap.put(String.valueOf(i), ((CatalogSecurityDtlRow)originRow.get(i)).getDtlNodeId());
        	}
        }
        ArrayList params = (ArrayList) session.getAttribute(ProjectConstants.POP_UP_CATALOG_TREE_NODE_ID_SET);
        session.removeAttribute(ProjectConstants.POP_UP_CATALOG_TREE_NODE_ID_SET);
        if(params != null && params.size() > 0) {
        	for(int i = 0; i < params.size(); i++) {
        		PopupCatalogTreeRow row = (PopupCatalogTreeRow) params.get(i);
        		CatalogSecurityDtlRow rowToAdd = new CatalogSecurityDtlRow();
        		if(originNodeMap == null || originNodeMap.size() == 0) {
        			rowToAdd.setCompanyCode(form.getCompanyCode());
            		rowToAdd.setDtlNodeId(row.getNodeId());
            		rowToAdd.setDtlCatalogName(row.getDescription());
            		rowToAdd.setUserCode(form.getUserCode());
            		rowToAdd.setDtlCatalogLevel(row.getCatalogLevel());
            		form.addRow(rowToAdd);
            		originNodeMap.put("0",row.getNodeId());
        		} else if(!originNodeMap.containsValue(row.getNodeId())) {
        			rowToAdd.setCompanyCode(form.getCompanyCode());
            		rowToAdd.setDtlNodeId(row.getNodeId());
            		rowToAdd.setDtlCatalogName(row.getDescription());
            		rowToAdd.setUserCode(form.getUserCode());
            		rowToAdd.setDtlCatalogLevel(row.getCatalogLevel());
            		form.addRow(rowToAdd);
            		originNodeMap.put(String.valueOf(originNodeMap.size()), row.getNodeId());
        		} else {
        			duplicateNodeList += "\"" + row.getDescription() + (i == params.size()-1 ? "\"" : "\",");
        		}
        	}
        	if(!CommonUtil.isEmpty(duplicateNodeList)) {
        		if(session.getAttribute(ProjectConstants.POP_UP_CATALOG_TREE_DUPLICATE_NODE_ID_SET) != null)
        			session.removeAttribute(ProjectConstants.POP_UP_CATALOG_TREE_DUPLICATE_NODE_ID_SET);
        		session.setAttribute(ProjectConstants.POP_UP_CATALOG_TREE_DUPLICATE_NODE_ID_SET, duplicateNodeList);
        	}
        }
        return actionForward;
    }



	////////////////////////////////////////////////////////////////////////////////
	// END OF LOGICAL AND BUSINESS METHODS
	////////////////////////////////////////////////////////////////////////////////


	////////////////////////////////////////////////////////////////////////////////
	// OVERRIDES PARENT'S OPTIONAL METHODS
	////////////////////////////////////////////////////////////////////////////////

	protected void initAction(ActionMapping mapping, ActionForm formIn,
		HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {

		super.initAction(mapping, formIn, request, response, errors);

		HttpSession session = request.getSession(false);
		CatalogSecurityMaintenanceForm form = (CatalogSecurityMaintenanceForm) formIn;
		String action = form.getPageEvent();
		ActionForward actionForward = new ActionForward(mapping.getInput());
		User editingUser = (User) session.getAttribute(ProjectConstants.SESSION_USER);

		try {
//			HashMap errMsgMap = WebUtil.getModuleErrorMessages(editingUser.getCompanyCode(),
//				DBMENU_GENERAL_MENU, form.getModuleName(), form.getSysLangCode(), DBMENU_OBJECT_TYPE_ERR_MSG);
//			form.setErrMsgMap(errMsgMap);

		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}



	protected void beforeCreate(ActionMapping mapping, ActionForm formIn,
		HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {

		HttpSession session = request.getSession(false);
		CatalogSecurityMaintenanceForm form = (CatalogSecurityMaintenanceForm) formIn;
		String action = form.getPageEvent();
		ActionForward actionForward = new ActionForward(mapping.getInput());
		User editingUser = (User) session.getAttribute(ProjectConstants.SESSION_USER);

		try {
			form.setCompanyCode(WebUtil.getAppropriateCompanyCode(session, null));
			form.setTs(new CatalogSecurityHdrSchema());
			form.setTsName("com.erp.app.catalog.catalogSecurity.schema.CatalogSecurityHdrSchema");
		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}




	public String getSessionMaintStatus() {

		return getSessionSimpleMaintStatus();
	}

	public String getSessionMaintPk() {

		return getSessionSimpleMaintPk();
	}

	public String getStrutsId() {

		return getFunctionId();
	}

	public String getSimpleFormReadOnlySessionName(){

		//TODO: Add the following line to ProjectWebConstants.java
		//public static final String SESSION_CATALOG_SECURITY_FORM_READ_ONLY_SESSION_NAME = "SESSION_CATALOG_SECURITY_FORM_READ_ONLY_SESSION_NAME";
		return ProjectConstants.SESSION_CATALOG_SECURITY_FORM_READ_ONLY_SESSION_NAME;
	}

	public String getSimpleFormReadOnlyCallerSessionName(){

		//TODO: Add the following line to ProjectWebConstants.java
		//public static final String SESSION_CATALOG_SECURITY_FORM_READ_ONLY_CALLER_SESSION_NAME = "SESSION_CATALOG_SECURITY_FORM_READ_ONLY_CALLER_SESSION_NAME";
		return ProjectConstants.SESSION_CATALOG_SECURITY_FORM_READ_ONLY_CALLER_SESSION_NAME;
	}

	protected String getSimpleSrchMenuId() {

		//TODO: Add the following line to ProjectMenuConstants.java
		//public static final String MOD_CATALOG_SECURITY = "MOD_CATALOG_SECURITY";
		return ProjectConstants.MOD_CATALOG_SECURITY;
	}

	////////////////////////////////////////////////////////////////////////////////
	// END OF OPTIONAL METHODS
	////////////////////////////////////////////////////////////////////////////////


	////////////////////////////////////////////////////////////////////////////////
	// IMPLEMENTS PARENT'S ABSTRACT METHODS
	////////////////////////////////////////////////////////////////////////////////

	protected String getModuleName(ActionMapping mapping, ActionForm formIn,
		HttpServletRequest request,HttpServletResponse response) {

		//TODO: Add the following line to ProjectMenuConstants.java
		//public static final String MOD_CATALOG_SECURITY = "MOD_CATALOG_SECURITY";
		return ProjectConstants.MOD_CATALOG_SECURITY;
	}

	protected String getFunctionId() {

		//struts-config xxxxx.do
		return "catalogSecurityMaintenance.do";
	}

	protected Class getMasterFormClass() {

		//the corresponding form class
		return CatalogSecurityMaintenanceForm.class;
	}

	protected Class getMasterVOClass() {

		//corresponding master vo class
		return CatalogSecurityHdrVo.class;
	}

	protected String getMasterFormSessionName() {

		return "catalogSecurityMaintenanceForm";
	}

	protected Class[] getChildRowClass() {

		Class[] childRowClass = new Class[2];

		childRowClass[0] = com.erp.app.catalog.catalogSecurity.web.CatalogSecurityDtlRow.class;
		childRowClass[1] = com.erp.app.catalog.catalogSecurity.web.CatalogSecurityFieldRow.class;
//		childRowClass[2] = com.erp.app.catalog.catalogSecurity.web.CatalogSecurityLightboxRow.class;

		return childRowClass;
	}

	protected String[] getFolderChildIdxMapping() {

		String[] folderChildIdx = new String[2];

		folderChildIdx[0] = String.valueOf(TAB_IDX_DTL);
		folderChildIdx[1] = String.valueOf(TAB_IDX_FIELD);


		return folderChildIdx;
	}

	protected SimpleBasePk getPk(ActionForm formIn, HttpServletRequest request) {

		CatalogSecurityMaintenanceForm form = (CatalogSecurityMaintenanceForm) formIn;
		CatalogSecurityHdrPk pk = null;
		HttpSession session = request.getSession(false);
		String companyCode = WebUtil.getAppropriateCompanyCode(session, null);

//		edit the following with appropriate form field names
		pk = new CatalogSecurityHdrPk(companyCode, form.getUserCode());
		return pk;
	}

	protected void setFormType(ActionMapping mapping, ActionForm formIn, HttpServletRequest request,
		HttpServletResponse response, ActionErrors errors){

		CatalogSecurityMaintenanceForm form = (CatalogSecurityMaintenanceForm) formIn;
		form.setFormType(ProjectConstants.FORM_TYPE_MAINT);
	}

	////////////////////////////////////////////////////////////////////////////////
	// END OF ABSTRACT METHODS
	////////////////////////////////////////////////////////////////////////////////
}
